Data models and databases are fundamental strengths of current enterprise systems. An important aspect for overall system performance is design of the data model and method of data loading. Java™ ™-based enterprise systems usually use Java™ persistence application programming interface (API), which is often referred to as JPA. JPA is a Java™ programming language application interface specification, which describes management of relational data in applications using the Java™ platform. Such relational data includes, but is not limited to, an entity, which is a single person, place, or thing about which data can be stored. Specifically, in data modeling, the entity is a unit of the data that is classified and has relationships to other entities.
JPA offers two strategies to load relational data into a Java™ application. One of these strategies is “eager loading”, which is a requirement on a persistence provider runtime that one or more entities be eagerly fetched. Persistence provider is a concrete implementation of JPA used by business application. In eager loading, an attribute of the one or more entities are fetched explicitly in a database without utilizing pointers to the one or more fetched entities. Accordingly, the persistence provider manages eager loading of related entities during runtime without requiring any interaction by a user.
The other strategy is “lazy loading”, which is a hint to the persistence provider runtime that the one or more entities can be fetched lazily in a database when the one or more entities are accessed for the first time. Lazy loading is commonly used to defer the loading of the attribute of the one or more entities until the point at which the one or more entities are desired. However, lazy loading strategy may not be optimal for all current or newly defined requirements, especially for large size Java™ applications with complex business logic. This is because lazy loading strategy loads data into the application when they are accessed by utilizing the pointers. This requires additional communication with database server at background, which is time and resources consuming operation. When business logic of the application requires all related data and such data are marked as “lazy loaded data”, there will be additional unnecessary communication at the background and delays in data processing as JPA implementation will have to wait for requested data.